package Model;

import java.io.Serializable;
import java.util.ArrayList;

public class Person implements Serializable
{
	private static final long serialVersionUID = 1L;
	
	private int id;
	private String fistname;
	private String surname;
	private int age;
	private ArrayList<Phone> phone = new ArrayList<Phone>();
	
	public Person()
	{
	}
	
	public Person( int id, String fistname, String surname, int age, ArrayList<Phone> phone)
	{
		this.id = id;
		this.fistname = fistname;
		this.surname = surname;
		this.age = age;
		this.phone = phone;
	}
	
	public Person( int id, String fistname, String surname, int age)
	{
		this.id = id;
		this.fistname = fistname;
		this.surname = surname;
		this.age = age;
	}
	
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getFistname() {
		return fistname;
	}

	public void setFistname(String fistname) {
		this.fistname = fistname;
	}

	public String getSurname() {
		return surname;
	}

	public void setSurname(String surname) {
		this.surname = surname;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public ArrayList<Phone> getPhone() {
		return phone;
	}

	public void setPhone(ArrayList<Phone> phone) {
		this.phone = phone;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Person other = (Person) obj;
		if (age != other.age)
			return false;
		if (fistname == null) {
			if (other.fistname != null)
				return false;
		} else if (!fistname.equals(other.fistname))
			return false;
		if (id != other.id)
			return false;
		if (phone == null) {
			if (other.phone != null)
				return false;
		} else if (!phone.equals(other.phone))
			return false;
		if (surname == null) {
			if (other.surname != null)
				return false;
		} else if (!surname.equals(other.surname))
			return false;
		return true;
	}

}
